<?php 
//DB Created by Rich L. a member in service in Northern Delaware.  Please feel free to share this code wherever it may be useful to alcholoics.  Should you have questons please contact me at sobernerd@gmail.com
require_once ('config/include_paths.php');
require_once('config.php');
require_once ('functions.php');
$googleAPI = true;
$pageTitle = SITE_NAME.' - Meeting Details';
require_once ('dbconnect.php');
require_once ('head.php');
 
$id= $_GET['id'];
	/* meetings query */
	$meetings_sql = mysql_query("SELECT day , mtime, open_closed, men_women, room, hc, 
					name, address, address2, city, state, zip, phone, website, 
					groupname, ir_fname, ir_lname, ir_home_phone, ir_cell_phone, ir_work_phone, ir_email, 
					code, description, explanation
					FROM meetings, groups, locations, meeting_types
					WHERE group_id = groups.id
					AND location_id = locations.id
					AND mtg_type_id = meeting_types.id
					AND meetings.id = $id");

$num_rows = mysql_num_rows($meetings_sql);
															
//set page variables
while($row = mysql_fetch_array($meetings_sql)){
$day=$row['day'];
$mtime=$row['mtime'];
$rawtime = strtotime($mtime);	
$meetings_time = date('g:iA',$rawtime);
$open_closed=$row['open_closed'];
if($open_closed == 'Open')
{$open_closed_desc= 'OPEN MEETINGS: As the term suggests, meetings of this type are open to alcoholics and their families and to anyone interested in solving a personal drinking problem or helping someone else to solve such a problem.';
}else{
$open_closed_desc= 'CLOSED MEETINGS: These meetings are limited to alcoholics. They provide an opportunity for members to share with one another on problems related to drinking patterns and attempts to achieve stable sobriety. They also permit detailed discussion of various elements in the recovery program.';}
$men_women=$row['men_women'];
$room=$row['room'];
$hc=$row['hc'];
$name=$row['name'];
$loc_address=$row['address'];
$loc_address2=$row['address2'];
$city=$row['city'];
$state=$row['state'];
$zip=$row['zip'];
$phone=$row['phone'];
$website=$row['website'];
$groupname=$row['groupname'];
$ir_fname=$row['ir_fname'];
$ir_lname=$row['ir_lname'];
$ir_li=substr($ir_lname, 0, 1);
if($ir_fname){
$ir_name="$ir_fname $ir_li";}else{
$ir_name="None";}
$ir_home_phone=$row['ir_home_phone'];
$ir_cell_phone=$row['ir_cell_phone'];
$ir_work_phone=$row['ir_work_phone'];
$ir_email=$row['ir_email'];
$code=$row['code'];
$description=$row['description'];
$explanation=$row['explanation'];									
// Set $longday
		switch ($row['day'])
		{
			case 1:
				$longday="Sunday";
				break;
			case 2:
				$longday="Monday";
				break;
			case 3:
				$longday="Tuesday";
				break;
			case 4:
				$longday="Wednesday";
				break;
			case 5:
				$longday="Thursday";
				break;
			case 6:
				$longday="Friday";
				break;
			case 7:
				$longday="Saturday";
				break;
		}
}									

$address= addslashes("$loc_address, $city, $state $zip");
$name = addslashes($name);
$website = addslashes($website); ?>
<body onLoad="codeAddress('<?php echo $address ?>','<?php echo $name ?>','<?php echo $website ?>')">
<div id="wrapper">
  <?php require_once ('header.php'); ?>
    <div id="content">
      <div class="fltlft">
          <table id="meetingDetails">
            <tr>
              <td class="labeltext" valign="top"><div align="right"> Day:</div></td>
              <td valign="top" nowrap="nowrap"><div align="left"> <?php echo $longday?></div></td>
              <td class="labeltext" valign="top" nowrap="nowrap" width="10"></td>
              <td class="labeltext" colspan="2" valign="top" nowrap="nowrap"><div align="left"> Meeting Type:</div></td>
            </tr>
            <tr>
              <td class="labeltext" valign="top"><div align="right"> Time:</div></td>
              <td valign="top" nowrap="nowrap"><?php echo $meetings_time?></td>
              <td align="left" valign="top" width="10"></td>
              <td colspan="2" align="left" valign="top"><div align="left"> <?php echo $open_closed?> - <?php echo $description?></div></td>
            </tr>
            <tr>
              <td class="labeltext" valign="top" nowrap="nowrap"><div align="right"> Men/Women:</div></td>
              <td valign="top" nowrap="nowrap"><div align="left"> <?php echo "$men_women";?></div></td>
              <td valign="top" width="10"></td>
              <td colspan="2" valign="top"><div class="labeltext" align="left"> Description:</div></td>
            </tr>
            <tr>
              <td class="labeltext" nowrap="nowrap"><div align="right">HC Accessible:</div></td>
              <td nowrap="nowrap"><?php echo "$hc";?></td>
              <td align="left" valign="top" width="10"></td>
              <td colspan="2" align="left" valign="top"><div align="left"> <?php echo $explanation?></div></td>
            </tr>
            <tr>
              <td colspan="5" valign="top"><hr />
              </td>
            </tr>
            <tr>
              <td class="labeltext"><div align="right"> Group:</div></td>
              <td colspan="4"><div align="left"> <?php echo $groupname?></div></td>
            </tr>
            <tr>
              <td class="labeltext" nowrap="nowrap"><div align="right"> Intergroup Rep:</div></td>
              <td colspan="4"><?php echo $ir_name?></td>
            </tr>
            <tr>
              <td colspan="5" valign="top"><hr />
              </td>
            </tr>
            <tr>
              <td class="labeltext" valign="top"><div align="right"> Location:</div></td>
              <td colspan="4" valign="top"><?php echo $name?><br />
                <?php echo $loc_address?><br />
                <?php echo $city?>, <?php echo $state?> <?php echo $zip?><br />
                <?php
						if($room){echo "$room <br />";}?>
                <?php echo $phone?></td>
            </tr>
          </table>
          <table width="358" border="0" cellpadding="3" >
            <tr>
              <td id="openCloseDesc"><?php echo $open_closed_desc?></td>
            </tr>
          </table>
          <div id="newSearch"><a href="meetings.php">new search</a></div>
        </div>
        <div class="googlemap">
          <div id="map_canvas"> <span style="color:#676767;font-size:11px;margin:0px;padding:0px;">Loading...</span></div>
          <div id="directionsPanel"></div>
        </div>
        <div class="clearfloat"></div>
      </div>
</body>
</html>
